package com.liukuan.netty.bio2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

/**
 * Created by liukuan on 16/3/30.
 */
public class BioTimeClient {
	
	public static void main(String[] args) throws UnknownHostException, IOException {
		Socket socket = new Socket("127.0.0.1", 5678);
		OutputStream out = socket.getOutputStream();
		String command = "time";
		out.write(command.getBytes());
		socket.shutdownOutput();
		
		InputStream in = socket.getInputStream();
		BufferedReader br = new BufferedReader(new InputStreamReader(in));
		String serverTime = br.readLine();
		System.out.println(serverTime);
		socket.close();
	}

	
}
